package com.yvtian.inv.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yvtian.inv.pojo.InvBomShopEntity;
import com.yvtian.inv.dao.InvBomShopMapper;
import com.yvtian.inv.service.InvBomShopService;
import com.yvtian.utils.StringHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * (inv_bom_shop)表服务实现类
 *
 * @author long
 * @since 2024-05-09 14:29:18
 */
@Service("invBomShopService")
public class InvBomShopServiceImpl extends ServiceImpl<InvBomShopMapper, InvBomShopEntity> implements InvBomShopService {

    @Autowired
    private InvBomShopMapper invBomShopMapper;

    @Override
    public IPage<InvBomShopEntity> findByPage(Page<InvBomShopEntity> page, InvBomShopEntity invBomShopEntity) {
        LambdaQueryWrapper<InvBomShopEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(InvBomShopEntity::getIsDel, 0);
        if (invBomShopEntity.getBomid() != null) {
            queryWrapper.eq(InvBomShopEntity::getBomid, invBomShopEntity.getBomid());
        }
        if (StringHelper.isNotEmpty(invBomShopEntity.getBomCode())){
            queryWrapper.eq(InvBomShopEntity::getBomCode, invBomShopEntity.getBomCode());
        }
        return this.page(page, queryWrapper);
    }
}

